/**
 * 
 */
package com.skivingcloud.file;

import java.io.File;
import java.util.Calendar;

/**
 * @author hushouquan
 *
 */
public class FilePathUtil {


	public static String getFileFolder(String fileStore) {
		Calendar c = Calendar.getInstance();
		String year = c.get(Calendar.YEAR) + "";
		String month = (c.get(Calendar.MONTH) + 1) + "";
		String ss = fileStore.endsWith(File.separator) ? (fileStore + year + File.separator + month + File.separator) : (fileStore + File.separator + year + File.separator + month + File.separator);
		File dir = new File(ss);
		if (!dir.exists()) {
			// 判断目录是否存在 
            dir.mkdirs();  
		}
		return ss;
	}

	public static String getHdfsFileFolder(String fileStore) {
		Calendar c = Calendar.getInstance();
		String year = c.get(Calendar.YEAR) + "";
		String month = (c.get(Calendar.MONTH) + 1) + "";
		String ss = fileStore.endsWith(File.separator) ? fileStore + year + "/" + month + "/" : fileStore + "/" + year + "/" + month + "/";
		return ss;
	}
}
